//
//  BaseViewController.m
//  Bubble
//
//  Created by A-01 on 2020/6/18.
//  Copyright © 2020 Mac. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@property (nonatomic, weak)UIImageView * backView;

@end

@implementation BaseViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self.navigationController setNavigationBarHidden:YES animated:YES];

}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithHexString:@"BBECC4"];
    
    UIImageView * bottomImageView = [[UIImageView alloc] init];
    
    bottomImageView.contentMode = UIViewContentModeScaleToFill;
    bottomImageView.image = [UIImage imageNamed:@"backView"];
    
    self.bottomImageView = bottomImageView;
    
    [self.view addSubview:self.bottomImageView];
    
    UIButton * backButton = [[UIButton alloc] init];
    
    [backButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(clickBackButton) forControlEvents:UIControlEventTouchUpInside];
    
    self.backButton = backButton;
    
    [self.view addSubview:self.backButton];
}

- (void)viewDidLayoutSubviews{
    
    [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.view).offset(30);
        make.top.mas_equalTo(self.view).offset(15);
        make.height.width.mas_equalTo(24);
    }];
    
    [self.bottomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.trailing.mas_equalTo(self.view);
        make.leading.mas_equalTo(self.view).offset(80);
        make.height.mas_equalTo(149);
    }];
}

- (void)clickBackButton{

    [self.navigationController popViewControllerAnimated:YES];
}

@end
